package com.example.dessert.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.dessert.dao.ProductSpecMapper;
import com.example.dessert.entity.ProductSpec;
import com.example.dessert.service.ProductSpecService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName: ProductSpecServiceImpl
 * @Description:
 * @Author
 * @Date 2022/1/13
 * @Version 1.0
 */
@Service
public class ProductSpecServiceImpl implements ProductSpecService {

    @Resource
    private ProductSpecMapper productSpecMapper;


    @Override
    public List<ProductSpec> queryProductSpecList(Long product_id) {

        QueryWrapper<ProductSpec> wrapper = new QueryWrapper<>();
        wrapper.eq("product_id",product_id);

        return productSpecMapper.selectList(wrapper);
    }


    @Override
    public ProductSpec queryProductSpecBuyId(Long id) {

        QueryWrapper<ProductSpec> wrapper = new QueryWrapper<>();
        wrapper.eq("id",id);
        return productSpecMapper.selectOne(wrapper);

    }

}
